package com.isdepci.project.carbon.controller;

import com.isdepci.common.utils.poi.ExcelUtil;
import com.isdepci.framework.aspectj.lang.annotation.Log;
import com.isdepci.framework.aspectj.lang.enums.BusinessType;
import com.isdepci.framework.web.controller.BaseController;
import com.isdepci.framework.web.domain.AjaxResult;
import com.isdepci.framework.web.page.TableDataInfo;
import com.isdepci.project.carbon.domain.BHeatEmissionParameter;
import com.isdepci.project.carbon.service.IBHeatEmissionParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 热力排放参数Controller
 *
 * @author isdepci
 * @date 2025-05-19
 */
@RestController
@RequestMapping("/heat/parameter")
public class BHeatEmissionParameterController extends BaseController
{
    @Autowired
    private IBHeatEmissionParameterService bHeatEmissionParameterService;

    /**
     * 查询热力排放参数列表
     */
    @PreAuthorize("@ss.hasPermi('heat:parameter:list')")
    @GetMapping("/list")
    public TableDataInfo list(BHeatEmissionParameter bHeatEmissionParameter)
    {
        startPage();
        List<BHeatEmissionParameter> list = bHeatEmissionParameterService.selectBHeatEmissionParameterList(bHeatEmissionParameter);
        return getDataTable(list);
    }

    /**
     * 导出热力排放参数列表
     */
    @PreAuthorize("@ss.hasPermi('heat:parameter:export')")
    @Log(title = "热力排放参数", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BHeatEmissionParameter bHeatEmissionParameter)
    {
        List<BHeatEmissionParameter> list = bHeatEmissionParameterService.selectBHeatEmissionParameterList(bHeatEmissionParameter);
        ExcelUtil<BHeatEmissionParameter> util = new ExcelUtil<BHeatEmissionParameter>(BHeatEmissionParameter.class);
        return util.exportExcel(list, "parameter");
    }

    /**
     * 获取热力排放参数详细信息
     */
    @PreAuthorize("@ss.hasPermi('heat:parameter:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bHeatEmissionParameterService.selectBHeatEmissionParameterById(id));
    }

    /**
     * 新增热力排放参数
     */
    @PreAuthorize("@ss.hasPermi('heat:parameter:add')")
    @Log(title = "热力排放参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BHeatEmissionParameter bHeatEmissionParameter)
    {
        return toAjax(bHeatEmissionParameterService.insertBHeatEmissionParameter(bHeatEmissionParameter));
    }

    /**
     * 修改热力排放参数
     */
    @PreAuthorize("@ss.hasPermi('heat:parameter:edit')")
    @Log(title = "热力排放参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BHeatEmissionParameter bHeatEmissionParameter)
    {
        return toAjax(bHeatEmissionParameterService.updateBHeatEmissionParameter(bHeatEmissionParameter));
    }

    /**
     * 删除热力排放参数
     */
    @PreAuthorize("@ss.hasPermi('heat:parameter:remove')")
    @Log(title = "热力排放参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bHeatEmissionParameterService.deleteBHeatEmissionParameterByIds(ids));
    }
}
